import { reqUpdatePassword, reqUpdateUserMessage } from "@/api"
import { Message } from "element-ui";
export default({
    namespaced:true,
    actions:{
        async updatePasswordByAccount(context,value){
            let result=await reqUpdatePassword(value);
            if(result.code==='200'){
                context.commit('updatePasswordByAccount',result.message)
            }else{
                Message({
                    message: '警告!'+'['+result.code+']'+'['+result.message+']',
                    type: 'warning'
                })
                return;
            }
        },
        async updateUserMessageByAccount({commit},value){
            let result=await reqUpdateUserMessage(value);
            if(result.code==='200'){
                commit('login/updateUserMessage',value,{root:true})
            }else{
                Message({
                    message: '警告!'+'['+result.code+']'+'['+result.message+']',
                    type: 'warning'
                })
                return;
            }
        }
    },
    mutations:{
        updatePasswordByAccount(state,value){
            state.isPasswordAlert=value;
        }
    },
    state:{
        isPasswordAlert:''
    },
    getters:{

    }
})